/**
 * Created by Nico on 2015/12/30.
 * 执行初始化工作
 */
var schema = require('../model/schema');
require('events').EventEmitter.prototype._maxListeners = 30; //设置最大监听数（默认最带为11，这里有27张表）
var Q = require('q');
module.exports = {
    initDatabase:function(){
        var deferred = Q.defer();
        schema.automigrate(function(err,result){
            if(err){
                deferred.reject(err);
            }else{
                deferred.resolve(result);
            }
        });
        return deferred.promise;
    }
};